package com.livesource.client.web.sourceCode.viewOptions;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.PopupPanel;
import com.livesource.client.model.entry.ProjectClass;
import com.livesource.client.web.LiveSourcePage;
import com.livesource.client.web.sourceCode.FeatureDescription;

/**
 * 
 * @UserInterface
 */
public class ButtonFeatureDescription extends HTML {

	public static final String imageUnpressed = "<a href='#'><img src='"
			+ GWT.getModuleName() + "/liveSource/images/list.gif'></a>";

	public static final String imagePressed = "<a href='#'><img src='"
			+ GWT.getModuleName()
			+ "/liveSource/images/listHighlighted.gif'></a>";

	public PopupPanel descriptionHint;

	public ButtonFeatureDescription(final ProjectClass entry) {

		this.setHTML(imageUnpressed);

		this.setTitle("Description");

		this.addClickHandler(new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				showDescription(entry);
			}
		});

		// this.setTitle(internationalizationConstants.description());

		/*
		 * descriptionHint =
		 * HelpHint.getHelpHintLinked(this.getClass().getName(),
		 * internationalizationConstants.description(), GlobalVariables.locale);
		 * 
		 * this.addMouseOverHandler(new MouseOverHandler() {
		 * 
		 * @Override public void onMouseOver(MouseOverEvent event) {
		 * 
		 * OptionsIcons.hideHints();
		 * 
		 * HelpHint.executeMouseOverHandler(event, descriptionHint, null);
		 * 
		 * } });
		 */
	}

	public static void showDescription(ProjectClass entry) {

		OptionsIcons.toggledButtons(entry);
		OptionsIcons.buttonDescription.setHTML(imagePressed);

		LiveSourcePage.featureVisualizationPanel.clear();

		LiveSourcePage.featureVisualizationPanel.add(new FeatureDescription(
				entry));
	}
}
